package com.deyuanyun.pic.settings.support.validateFunc;

import com.deyuanyun.pic.common.validator.vinterface.ValidateInterface;
import java.util.List;

import com.deyuanyun.pic.common.spring.SpringAppliction;
import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.validator.vinterface.ValidateInterface;
import com.deyuanyun.pic.settings.domain.org.OrgInfo;
import com.deyuanyun.pic.settings.mapper.prvlg.UserMapper;

public class CompanyValidata implements ValidateInterface {
	
	@Override
	public <T, E, C> boolean apply(T t, E e, C c) {
		List<OrgInfo> company = null;
		StringBuffer sb = new StringBuffer();
		if(ObjectUtil.isNotNullEmpty(t)){
//			company = TempStoreDataSupport.pullDataf("tt_company");
//			if(ObjectUtil.isEmptyAll(company)){
				UserMapper um = SpringAppliction.getBean(UserMapper.class);
				company = um.selectAllCompany();
				for (OrgInfo org : company) {
					sb.append(org.getName()).append(",");
				}
//				TempStoreDataSupport.pushDataf("tt_company", company);
//			}
		}
		return sb.toString().contains((String)t.toString());
	}

	@Override
	public String getName() {
		return null;
	}
	
}
